Rules_table objects are just another way of specifying rules, except the conditions are in a table instead of using the if-then format. For example the following rules:
if shape = "circle" then area = pi * radius ** 2, if shape = "square" then area = side * side
can be specified in a rules_table named 'area':
id |
area |
||||||
path |
/ |
||||||
type |
single_value |
||||||
rules |
|
Not all rules can be specified in tables, only those whose conditions are 'anded'
together. For example, this rules_table (named 'walk'):
pet weight health walk "cocker spaniel" < 30 good 1
is equivalent to:
if pet = "cocker spaniel" and weight < 30 and health = good
then walk = 1
You can also specify multiple conditions in a column using 'and', 'or' and 'not'. For example:
colors area thing include "blue" and include "red" >= 100 or < 10 "a purplish sort of thing" include "blue" and (not include "red") or include "red" and (not include "blue") * "not purple thing"
The special condition '*' will match any value.
The KnowledgeWright reasoning engine examines the rows in the rules_table in
order starting with the first row and continuing onto the last.
Rules_tables can use all the comparators, functions, arithmetic operators and date arithmetic available for rules, and must following the same syntatic restrictions. The properties of rules_tables are:
| Property Name | Description | Default Value | Required |
| id | The name of this object. See Object Names for details. | <none> | yes |
| path | The folder this object is located in. See Folders for details. | / | yes |
| description | A text description (comment)--not used during reasoning. | <none> | no |
| type | Whether or not these rules result in a fact (or goal) having a single value or multiple values. | yes | |
| rules | Any number of columns representing conditions which are anded together and a last column with the same name as id which is the resulting value or values. | yes |